#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>

char* my_strncat(char* str1, const char* str2, size_t num)
{
	char* cp = str1;
	while (*cp)
	{
		cp++;
	}
	int i = 0;
	for (i = 0; i < num; i++)
	{
		*cp = *str2;
		if (*str2 == '\0')
		{
			return str1;
		}
		cp++;
		str2++;
	}
	return str1;
}

int main()
{
	char arr1[20] = "abc\0xxxxxxxxxx";
	char arr2[] = "defghijkl";

	my_strncat(arr1, arr2, 5);
	printf("%s", arr1);

	return 0;
}